package com.deft.design.visitor;

import com.deft.design.visitor.user.User;
import com.deft.design.visitor.user.impl.Student;
import com.deft.design.visitor.user.impl.Teacher;
import com.deft.design.visitor.visitor.Visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Hide丶love
 * @date 2022/05/30
 **/
public class DataView {

    List<User> userList = new ArrayList<>();

    public DataView() {
        userList.add(new Student("windy", "普通班", "一年一班"));
        userList.add(new Student("deft", "重点班", "一年二班"));
        userList.add(new Student("hide", "重点班", "三年二班"));
        userList.add(new Student("echo", "普通班", "二年三班"));
        userList.add(new Teacher("jay", "特级教师", "三年二班"));
        userList.add(new Teacher("clearlove", "普通教师", "一年二班"));
        userList.add(new Teacher("vce", "普通教师", "二年三班"));
    }

    public void show(Visitor visitor) {
        for (User user : userList) {
            user.accept(visitor);
        }
    }
}
